<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
<%@ page session="false" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">

<html xmlns="http://www.w3.org/1999/xhtml">
	<head>
		<%@include file="header.jsp" %>
		<script type="text/javascript">
			$(document).delegate(".activeoffer", "click", function() {
			   window.location = $(this).find("a").attr("href");
			});
			
			$(document).delegate(".activeoffer", "hover", function() {
				$(this).toggleClass("selected");   
			});
			
		</script>
	</head>
	<body>
		<div id="wrapper">
			<div id="splash">
				<img src="resources/images/pic1.jpg" alt="" />
			</div>
			<div id="menu">
				<ul>				
					<li><a href="index">Homepage</a></li>
					<li><a href="notebooks">Notebooks</a></li>
					<li>Account <span class="arrow"></span>
						<ul>
							<c:choose>
								<c:when test="${ firstname != null }">
									<li class="first"><a href="logout">Logout</a></li>
								</c:when>
								<c:when test="${ firstname == null}">
									<li class="first"><a href="login">Inloggen</a></li>
									<li><a href="registratie">Registreren</a></li>
								</c:when>
							</c:choose>	
						</ul>
					</li>
					<li><a href="about">About</a></li>
					<c:choose>
						<c:when test="${ admin == 0 || admin == null }">
							<li class ="cartI"> <img src="resources/images/shopping_cart.png" alt="" /></li>
							<li class ="cart"><a href="winkelwagen">Winkelwagen</a></li>
						</c:when>
						<c:when test="${ admin == 1 }">
							<li class ="cartI"> <img src="resources/images/adminmodule.png" alt="" /></li>
							<li class ="cart"><a href="admin">Admin module</a></li>
						</c:when>
					</c:choose>		
				</ul>				
				<br class="clearfix" />
			</div>
			
			<div id="page">
				<div id="content">
					<div class="box">
						<h1>Welkom bij Notebook shop</h1>
						<br />
						<c:set var="i" value="1" />
						<div class="offercontainer">
						<c:forEach items="${activeoffers}" var="offer" >
							<div class="activeoffer">
								<h3 class="center" >Aanbieding <c:out value="${i}" /></h3>
								<img class="center" src="resources/images/producten/${offer.EAN_UCC_13}/small.jpg" alt="${offer.name}" height="150" width="150" />
								<br /> 
								<b>${offer.name}</b>
								<br />
								<span class="price">&euro; ${offer.price}</span> <b>${offer.discount}</b>% korting
								<br />
								<i>minstens <b>${offer.minParticipators}</b> inschrijvingen</i>
								<c:choose>
									<c:when test="${offer.amount == 1}">																	<br />
										<b>${offer.amount}</b> inschrijving - nog <b><c:out value="${offer.minParticipators - offer.amount}"></c:out></b> nodig !
									</c:when>
									<c:when test="${offer.amount >= offer.minParticipators}">
										<br />Notebook is <b>nu</b> beschikbaar !
									</c:when>
									<c:otherwise>
										<br />
										<b>${offer.amount}</b> inschrijvingen - nog <b><c:out value="${offer.minParticipators - offer.amount}"></c:out></b> nodig !
									</c:otherwise>
								</c:choose>						
								<br />
								Einddatum : ${offer.availabilityEnd}
								<a href="specs?ID=${offer.EAN_UCC_13}"></a>
								<c:set var="i" value="${i + 1}" />
							</div>
						</c:forEach>
						</div>
					</div>				
					<br class="clearfix" />
				</div>
				<div id="sidebar">
					<div class="box" >
					<h3>Mijn Account</h3>
								<c:choose>
									<c:when test="${firstname != null}">
									Welkom, <a href="account" ><c:out value="${firstname}"></c:out></a>
									</c:when>
									<c:when test="${firstname == null}">
									Log nu in !
									</c:when>
								</c:choose>
					</div>
					<div class="box">
						<h3>contact</h3>
						<p>
							Neem contact op door <a href="mailto:info@notebookshop.com">hier</a> te klikken.
						</p>
					</div>
				</div>
				<br class="clearfix" />
			</div>
		</div>
		<div id="footer">
			
		</div>
	</body>
</html>